import { defineStore } from "pinia";
import { GetTongYongMingJiBingSel } from "@/api/modules/zhenDuanJieGuo";
// import piniaPersistConfig from "@/stores/helper/persist";

export const useZhenDuanJieGuo = defineStore({
  id: "zhenDuanJieGuo",
  state: () => ({
    TongYongMingID: "" as string,
    // 疾病列表数据
    JiBingLieBiao: [] as any,
    // 中间的表格的Id
    jiBingID: "" as string,
    // 疾病表格点击
    jiBingTableSomeOne: {} as any,
    jiBingTableAddList: {} as any
  }),
  getters: {},
  actions: {
    setTongYongMingIDChange(data: string) {
      this.TongYongMingID = data;
      this.getTongYongMingJiBingSel();
    },
    getTongYongMingJiBingSel() {
      let obj = {
        strTongYongMingID: this.TongYongMingID
      };
      GetTongYongMingJiBingSel(obj).then((res: any) => {
        if (res.Success === 0) {
          console.log(res, "res");
          this.JiBingLieBiao = res.Data;
        }
      });
    },
    setJiBingID(data: string) {
      this.jiBingID = data;
    },
    setJiBingTableSomeOne(data: {}) {
      this.jiBingTableSomeOne = data;
    },
    setJiBingTableAddList(data: {}) {
      this.jiBingTableAddList = {
        ...data
      };
    }
  }
  // persist: piniaPersistConfig("geeker-integratedProject")
});
